<!DOCTYPE html>
<html lang="zh-cn">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		 
			
  
    <meta name="twitter:card" content="summary"/>
    
      <meta name="twitter:image" content="https://www.samrainhan.com/images/avatar.png" />
    
  
  
  <meta name="twitter:title" content="如何把内网的服务公布到公网上"/>
  <meta name="twitter:description" content="ngrok 这个是一个用来把内网服务公布到公网的开源程序，但是很不幸的是被炝了。以下是如何配置使用。 下载 https://ngrok.com/download 配置 编辑配置文件 ngrok.config auth_token: dxW21sgRz-DscM932vgkDxe http_proxy: &quot;http://192.168.16.41:60002&quot; tunnels: calibre-server: subdomain: samebook proto: https: 8080 其中"/>
  
  
  
  
    <meta name="twitter:creator" content="@韩雨"/>
  



		
		<meta name="author" content="韩雨">
		<meta name="description" content="学习 &amp;nbsp;&amp;bull;&amp;nbsp; 生活">
		<meta name="generator" content="Hugo 0.52" />
		<title>如何把内网的服务公布到公网上 &middot; sam的小窝</title>
		<link rel="shortcut icon" href="https://www.samrainhan.com/images/favicon.ico">
		<link rel="stylesheet" href="https://www.samrainhan.com/css/style.css">
		<link rel="stylesheet" href="https://www.samrainhan.com/css/highlight.css">

		
		<link rel="stylesheet" href="https://www.samrainhan.com/css/font-awesome.min.css">
		

		
		<link href="https://www.samrainhan.com/index.xml" rel="alternate" type="application/rss+xml" title="sam的小窝" />
		

		
	</head>

    <body>
       <nav class="main-nav">
	
	
		<a href='https://www.samrainhan.com/'> <span class="arrow">←</span>Home</a>
	
	<a href='https://www.samrainhan.com/posts'>Archive</a>
	<a href='https://www.samrainhan.com/tags'>Tags</a>
	<a href='https://www.samrainhan.com/about'>About</a>

	

	
	<a class="cta" href="https://www.samrainhan.com/index.xml">Subscribe</a>
	
</nav>


        <section id="wrapper" class="post">
            <article>
                <header>
                    <h1>
                        如何把内网的服务公布到公网上
                    </h1>
                    <h2 class="headline">
                    Apr 20, 2016 00:00
                    · 197 words
                    · 1 minute read
                      <span class="tags">
                      
                      
                          
                              <a href="https://www.samrainhan.com/tags/shadowsocks">shadowsocks</a>
                          
                              <a href="https://www.samrainhan.com/tags/ngrok">ngrok</a>
                          
                              <a href="https://www.samrainhan.com/tags/privoxy">privoxy</a>
                          
                              <a href="https://www.samrainhan.com/tags/%E5%8F%91%E5%B8%83">发布</a>
                          
                              <a href="https://www.samrainhan.com/tags/%E4%BB%A3%E7%90%86">代理</a>
                          
                              <a href="https://www.samrainhan.com/tags/proxy">proxy</a>
                          
                      
                      
                      </span>
                    </h2>
                </header>
                
                  
                    <div id="toc">
                      <nav id="TableOfContents">
<ul>
<li>
<ul>
<li><a href="#ngrok-a-id-sec-4-1-name-sec-4-1-a">ngrok<a id="sec-4-1" name="sec-4-1"></a></a>
<ul>
<li><a href="#下载-a-id-sec-4-1-1-name-sec-4-1-1-a">下载<a id="sec-4-1-1" name="sec-4-1-1"></a></a></li>
<li><a href="#配置-a-id-sec-4-1-2-name-sec-4-1-2-a">配置<a id="sec-4-1-2" name="sec-4-1-2"></a></a></li>
</ul></li>
<li><a href="#shadowsocks-a-id-sec-4-2-name-sec-4-2-a">shadowsocks<a id="sec-4-2" name="sec-4-2"></a></a>
<ul>
<li><a href="#下载-a-id-sec-4-2-1-name-sec-4-2-1-a">下载<a id="sec-4-2-1" name="sec-4-2-1"></a></a></li>
<li><a href="#配置-a-id-sec-4-2-2-name-sec-4-2-2-a">配置<a id="sec-4-2-2" name="sec-4-2-2"></a></a></li>
<li><a href="#运行-a-id-sec-4-2-3-name-sec-4-2-3-a">运行<a id="sec-4-2-3" name="sec-4-2-3"></a></a></li>
</ul></li>
<li><a href="#privoxy-a-id-sec-4-3-name-sec-4-3-a">privoxy<a id="sec-4-3" name="sec-4-3"></a></a>
<ul>
<li><a href="#安装-a-id-sec-4-3-1-name-sec-4-3-1-a">安装<a id="sec-4-3-1" name="sec-4-3-1"></a></a></li>
<li><a href="#配置-a-id-sec-4-3-2-name-sec-4-3-2-a">配置<a id="sec-4-3-2" name="sec-4-3-2"></a></a></li>
<li><a href="#运行-a-id-sec-4-3-3-name-sec-4-3-3-a">运行<a id="sec-4-3-3" name="sec-4-3-3"></a></a></li>
</ul></li>
</ul></li>
</ul>
</nav>
                    </div>
                  
                
                <section id="post-body">
                    

<h2 id="ngrok-a-id-sec-4-1-name-sec-4-1-a">ngrok<a id="sec-4-1" name="sec-4-1"></a></h2>

<p>这个是一个用来把内网服务公布到公网的开源程序，但是很不幸的是被炝了。以下是如何配置使用。</p>

<h3 id="下载-a-id-sec-4-1-1-name-sec-4-1-1-a">下载<a id="sec-4-1-1" name="sec-4-1-1"></a></h3>

<p><a href="https://ngrok.com/download">https://ngrok.com/download</a></p>

<h3 id="配置-a-id-sec-4-1-2-name-sec-4-1-2-a">配置<a id="sec-4-1-2" name="sec-4-1-2"></a></h3>

<p>编辑配置文件 ngrok.config</p>

<pre><code>auth_token: dxW21sgRz-DscM932vgkDxe
http_proxy: &quot;http://192.168.16.41:60002&quot;

tunnels:
calibre-server:
subdomain: samebook
proto:
https: 8080
</code></pre>

<p>其中http_proxy指向下面配置的网关。</p>

<h2 id="shadowsocks-a-id-sec-4-2-name-sec-4-2-a">shadowsocks<a id="sec-4-2" name="sec-4-2"></a></h2>

<p>科学上网工具，不解释了。</p>

<h3 id="下载-a-id-sec-4-2-1-name-sec-4-2-1-a">下载<a id="sec-4-2-1" name="sec-4-2-1"></a></h3>

<p><a href="http://shadowsocks.org/en/download/clients.html">http://shadowsocks.org/en/download/clients.html</a></p>

<h3 id="配置-a-id-sec-4-2-2-name-sec-4-2-2-a">配置<a id="sec-4-2-2" name="sec-4-2-2"></a></h3>

<p>编辑配置文件config.json</p>

<pre><code>{
&quot;server&quot;:&quot;aaa.bbb.ccc.ddd&quot;,
&quot;server_port&quot;:8388,
&quot;local_port&quot;:60001,
&quot;password&quot;:&quot;CCCCCCCCC&quot;,
&quot;timeout&quot;:600,
&quot;method&quot;:&quot;aes-256-cfb&quot;
}
</code></pre>

<h3 id="运行-a-id-sec-4-2-3-name-sec-4-2-3-a">运行<a id="sec-4-2-3" name="sec-4-2-3"></a></h3>

<pre><code>~/ngrok/shadowsocks-local-linux64-1.1.3 -c=~/ngrok/config.json &amp;
</code></pre>

<h2 id="privoxy-a-id-sec-4-3-name-sec-4-3-a">privoxy<a id="sec-4-3" name="sec-4-3"></a></h2>

<p>转换各种服务为http代理</p>

<h3 id="安装-a-id-sec-4-3-1-name-sec-4-3-1-a">安装<a id="sec-4-3-1" name="sec-4-3-1"></a></h3>

<pre><code>sudo apt-get install Privoxy
</code></pre>

<h3 id="配置-a-id-sec-4-3-2-name-sec-4-3-2-a">配置<a id="sec-4-3-2" name="sec-4-3-2"></a></h3>

<p>编辑配置文件/etc/privoxy/config</p>

<pre><code>listen-address  192.168.16.41:60002
forward-socks5   /               127.0.0.1:60001 .
</code></pre>

<h3 id="运行-a-id-sec-4-3-3-name-sec-4-3-3-a">运行<a id="sec-4-3-3" name="sec-4-3-3"></a></h3>

<pre><code>sudo service privoxy restart
</code></pre>

                </section>
            </article>

            
                <a class="twitter" href="https://twitter.com/intent/tweet?text=https%3a%2f%2fwww.samrainhan.com%2fposts%2f2016-04-20-publish-services-of-intarnet-on-internet%2f - %e5%a6%82%e4%bd%95%e6%8a%8a%e5%86%85%e7%bd%91%e7%9a%84%e6%9c%8d%e5%8a%a1%e5%85%ac%e5%b8%83%e5%88%b0%e5%85%ac%e7%bd%91%e4%b8%8a "><span class="icon-twitter"> tweet</span></a>

<a class="facebook" href="#" onclick="
    window.open(
      'https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(location.href),
      'facebook-share-dialog',
      'width=626,height=436');
    return false;"><span class="icon-facebook-rect"> Share</span>
</a>

            

            
                <div id="disqus_thread"></div>
<script type="text/javascript">
    var disqus_shortname = 'samrainblogbygithub'; 

     
    (function() {
        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
        dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>

            

            
                <ul id="post-list" class="archive readmore">
    <h3>Read more</h3>

    
    
    
        <li>
            <a href="/posts/2019-04-26-c9-move-to-aws-c9/">Cloud9 Move to Aws C9<aside class="dates">Apr 26 2019</aside></a>
        </li>
    
        <li>
            <a href="/posts/2019-02-16-why-build-blog-with-cloud9/">2019 02 16 Why Build Blog With Cloud9<aside class="dates">Feb 16 2019</aside></a>
        </li>
    
        <li>
            <a href="/posts/2018-09-12-sports-stretching-best-practices/">运动拉伸最佳实践<aside class="dates">Sep 12 2018</aside></a>
        </li>
    
        <li>
            <a href="/posts/2018-09-12-add-2-files-to-tempdb-for-caching/">给tempdb加2个文件做缓存<aside class="dates">Sep 12 2018</aside></a>
        </li>
    
        <li>
            <a href="/posts/2018-09-12-look-for-sql-server-tables-without-a-clustered-index/">如何找到没有聚集索引的表<aside class="dates">Sep 12 2018</aside></a>
        </li>
    
        <li>
            <a href="/posts/2018-09-12-the-continuous-delivery-maturity-model/">持续实施成熟度模型<aside class="dates">Sep 12 2018</aside></a>
        </li>
    
        <li>
            <a href="/posts/2018-09-12-map-of-continuous-delivery/">持续发布的各个阶段<aside class="dates">Sep 12 2018</aside></a>
        </li>
    
        <li>
            <a href="/posts/2018-09-12-how-dropbox-securely-stores-your-passwords/">Dropbox的用户密码加密机制<aside class="dates">Sep 12 2018</aside></a>
        </li>
    
        <li>
            <a href="/posts/2018-09-12-code-inspection-tool-for-net/">NET代码检查工具<aside class="dates">Sep 12 2018</aside></a>
        </li>
    
        <li>
            <a href="/posts/2018-09-12-how-to-make-unique-id/">怎样生成唯一ID<aside class="dates">Sep 12 2018</aside></a>
        </li>
    
</ul>

            

            <footer id="footer">
    
        <div id="social">

	
	
    <a class="symbol" href="">
        <i class="fa fa-facebook-square"></i>
    </a>
    
    <a class="symbol" href="https://github.com/samrain">
        <i class="fa fa-github-square"></i>
    </a>
    
    <a class="symbol" href="">
        <i class="fa fa-twitter-square"></i>
    </a>
    


</div>

    
    <p class="small">
    
       © Copyright 2019 <i class="fa fa-heart" aria-hidden="true"></i> 韩雨
    
    </p>
    <p class="small">
        Powered by <a href="http://www.gohugo.io/">Hugo</a> Theme By <a href="https://github.com/nodejh/hugo-theme-cactus-plus">nodejh</a>
    </p>
</footer>

        </section>

        <script src="https://www.samrainhan.com/js/jquery-3.3.1.min.js"></script>
<script src="https://www.samrainhan.com/js/main.js"></script>
<script src="https://www.samrainhan.com/js/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>




  
<script type="application/javascript">
var doNotTrack = false;
if (!doNotTrack) {
	(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
	(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
	m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
	})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
	ga('create', 'UA-37708730-1', 'auto');
	
	ga('send', 'pageview');
}
</script>





    </body>
</html>
